<?php

$LQBU_pathinfo = pathinfo(__FILE__);

include $LQBU_pathinfo['dirname'].DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."LQueryBU".DIRECTORY_SEPARATOR."LQueryBU.php";


class index
{
    private $numRowsPerPage = 10;
    private $exampleNum = 1;
    
    function run($example = 1)
    {
        $this->getData();
    }
    
    function getNavVars()
    {
        $pag = isset($_GET["pag"])?$_GET["pag"]:1;
        $ord = isset($_GET["ord"])?$_GET["ord"]:1;  
        $sen = isset($_GET["sen"])?$_GET["sen"]:1; 
        if ($pag=="" or $pag <1) $pag = 1;
        if ($ord=="" or $ord<1)  $ord = 1;
        if ($sen=="" or $sen<0 or $sen > 2) $sen=1;
       
        return array($pag,$ord,$sen);
    }
    
    function getData()
    {
        
        list($pag,$ord,$sen) = $this->getNavVars();
        
        $LQueryBU = new LQueryBU();

		$LQueryBU->setProperties(array("debugQuery"=>TRUE,"fieldsInfo" => TRUE));
		$RESULT = $LQueryBU->getDataQuery("/units/getCountries",array("LIMIT_FROM"=>0+(($pag-1)*$this->numRowsPerPage),"LIMIT_TO"=>$this->numRowsPerPage,"ORDER_BY" => $ord,"ASCDESC"=>$sen));
//		var_dump($LQueryBU->dumpDebugQuery());
		$RESULTINFO = $LQueryBU->sqlFieldsInfo;
//		var_dump($LQueryBU->numRows);
		$debugSQL = $LQueryBU->dumpQuery();
		
      	include "./example1.phtml";
    }
}


$exampleNum = isset($_GET["exp"])?$_GET["exp"]:1;

$index = new Index($exampleNum);
$index->run();